package com.huixh.train.batch.config;

import jakarta.annotation.Resource;
import org.jetbrains.annotations.NotNull;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
import org.springframework.stereotype.Component;
/**
 * @author huixh
 */
@Component
public class TrainJobFactory extends SpringBeanJobFactory {
    @Resource
    private AutowireCapableBeanFactory autowireCapableBeanFactory;

    @Override
    @NotNull
    protected Object createJobInstance(@NotNull TriggerFiredBundle bundle) throws Exception {
        Object jobInstance = super.createJobInstance(bundle);
        autowireCapableBeanFactory.autowireBean(jobInstance);
        return jobInstance;
    }
}
